class Solution:
    def countBits(self, num: int) -> list:
        res = [0]
        for i in range(1, num+1):
            res.append(res[i >> 1] + (i & 1))
        return res


a = Solution()
print(a.countBits(0))
print(a.countBits(2))
print(a.countBits(5))
print(a.countBits(10))
